1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module sourceview.StyleSchemePreview; 26 27 private import glib.ConstructionException; 28 private import gobject.ObjectG; 29 private import gobject.Signals; 30 private import gtk.AccessibleIF; 31 private import gtk.AccessibleT; 32 private import gtk.ActionableIF; 33 private import gtk.ActionableT; 34 private import gtk.BuildableIF; 35 private import gtk.BuildableT; 36 private import gtk.ConstraintTargetIF; 37 private import gtk.ConstraintTargetT; 38 private import gtk.Widget; 39 private import sourceview.StyleScheme; 40 private import sourceview.c.functions; 41 public import sourceview.c.types; 42 private import std.algorithm; 43 44 45 /** 46 * A preview widget for [class@StyleScheme]. 47 * 48 * This widget provides a convenient [class@Gtk.Widget] to preview a [class@StyleScheme]. 49 * 50 * The [property@StyleSchemePreview:selected] property can be used to manage 51 * the selection state of a single preview widget. 52 * 53 * Since: 5.4 54 */ 55 public class StyleSchemePreview : Widget, ActionableIF 56 { 57 /** the main Gtk struct */ 58 protected GtkSourceStyleSchemePreview* gtkSourceStyleSchemePreview; 59 60 /** Get the main Gtk struct */ 61 public GtkSourceStyleSchemePreview* getStyleSchemePreviewStruct(bool transferOwnership = false) 62 { 63 if (transferOwnership) 64 ownedRef = false; 65 return gtkSourceStyleSchemePreview; 66 } 67 68 /** the main Gtk struct as a void* */ 69 protected override void* getStruct() 70 { 71 return cast(void*)gtkSourceStyleSchemePreview; 72 } 73 74 /** 75 * Sets our main struct and passes it to the parent class. 76 */ 77 public this (GtkSourceStyleSchemePreview* gtkSourceStyleSchemePreview, bool ownedRef = false) 78 { 79 this.gtkSourceStyleSchemePreview = gtkSourceStyleSchemePreview; 80 super(cast(GtkWidget*)gtkSourceStyleSchemePreview, ownedRef); 81 } 82 83 // add the Actionable capabilities 84 mixin ActionableT!(GtkSourceStyleSchemePreview); 85 86 87 /** */ 88 public static GType getType() 89 { 90 return gtk_source_style_scheme_preview_get_type(); 91 } 92 93 /** 94 * Creates a new #GtkSourceStyleSchemePreview to preview the style scheme 95 * provided in @scheme. 96 * 97 * Params: 98 * scheme = a #GtkSourceStyleScheme 99 * 100 * Returns: a #GtkWidget 101 * 102 * Since: 5.4 103 * 104 * Throws: ConstructionException GTK+ fails to create the object. 105 */ 106 public this(StyleScheme scheme) 107 { 108 auto __p = gtk_source_style_scheme_preview_new((scheme is null) ? null : scheme.getStyleSchemeStruct()); 109 110 if(__p is null) 111 { 112 throw new ConstructionException("null returned by new"); 113 } 114 115 this(cast(GtkSourceStyleSchemePreview*) __p, true); 116 } 117 118 /** 119 * Gets the #GtkSourceStyleScheme previewed by the widget. 120 * 121 * Returns: a #GtkSourceStyleScheme 122 * 123 * Since: 5.4 124 */ 125 public StyleScheme getScheme() 126 { 127 auto __p = gtk_source_style_scheme_preview_get_scheme(gtkSourceStyleSchemePreview); 128 129 if(__p is null) 130 { 131 return null; 132 } 133 134 return ObjectG.getDObject!(StyleScheme)(cast(GtkSourceStyleScheme*) __p); 135 } 136 137 /** */ 138 public bool getSelected() 139 { 140 return gtk_source_style_scheme_preview_get_selected(gtkSourceStyleSchemePreview) != 0; 141 } 142 143 /** */ 144 public void setSelected(bool selected) 145 { 146 gtk_source_style_scheme_preview_set_selected(gtkSourceStyleSchemePreview, selected); 147 } 148 149 /** */ 150 gulong addOnActivate(void delegate(StyleSchemePreview) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 151 { 152 return Signals.connect(this, "activate", dlg, connectFlags ^ ConnectFlags.SWAPPED); 153 } 154 }